package gao.xiaolei.quertz;

import gao.xiaolei.util.ServiceName;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;

@DisallowConcurrentExecution
public class ClassesOpenJob implements Job {
    @Autowired
    private RestTemplate restTemplate;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String classesId = jobExecutionContext.getJobDetail().getKey().getGroup();
        restTemplate.getForObject(ServiceName.AUTH_SERVICE.getServiceName().concat("/classes/onTime/openClasses/").concat(classesId), String.class);
    }
}
